{% for item in prometheus_targets_clickhouse %}
{%- set os = [] -%}
- targets: ['{{ hostvars[item]['ansible_host'] }}:9363']
  labels:
    {% for group in hostvars[item]['group_names'] -%}
    {%- if group | regex_search('os\.(u\d+|[crf].*\d+)') -%}
    {{ os.append(group | regex_replace('^(.*)\.(.*)$','\\2')) }}
    {%- endif -%}
    {%- endfor -%}
    all:  "{{ item }}"
    os:   "{{ os|unique|join('#') }}"
{% endfor %}
